package appendix;
import java.util.ArrayList;
import java.util.Iterator;

import mainpackage.Category;

public class ArrayListDemo {
	public static void main(String [] args){
		ArrayList<String> pets = new  ArrayList<String>();
		pets.add("dog");
		pets.add("cat");
		pets.add("dog");
		pets.add("bird");
		pets.add("fish");
		
		Iterator petsIt = pets.iterator();
		while(petsIt.hasNext()){
			String pet = (String)petsIt.next();
			System.out.println(pet);
		}
		
		System.out.println(pets);
		System.out.println(pets.size());
		System.out.println(pets.get(2));
		pets.remove(2);
		System.out.println(pets);
		
		
		ArrayList<Category> Items = new ArrayList<Category>();
		Items.add(Category.ENTREE);
		Items.add(Category.MAIN_COURSE);
		Items.add(Category.DESERT);
		System.out.println(Items);
		Iterator itemsIt = Items.iterator();
		while(itemsIt.hasNext()){
			Category item = (Category)itemsIt.next();
			System.out.println(item);
		}
	}
}
